Include(FetchContent)

set(FETCHCONTENT_UPDATES_DISCONNECTED true)
# set(FETCHCONTENT_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fetchContent)
set(FETCHCONTENT_QUIET off)
# set(FETCHCONTENT_QUIET false CACHE BOOL "Flag for quiet execution of FetchContent")

FetchContent_Declare(
	spdlog
	GIT_REPOSITORY https://github.com/gabime/spdlog.git
	GIT_TAG        v1.9.2
	GIT_SHALLOW    true
	GIT_PROGRESS   true
	SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spdlog
	CMAKE_ARGS
	-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
	-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
	-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
	-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
	-DSPDLOG_BUILD_SHARED=OFF
)
FetchContent_MakeAvailable(spdlog)

if( ${CMAKE_TESTING_ENABLED} )
	FetchContent_Declare(
		Catch2
		GIT_REPOSITORY https://github.com/catchorg/Catch2.git
		GIT_TAG        v3.1.0
		GIT_SHALLOW    true
		GIT_PROGRESS   true
		SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Catch2
	)

	FetchContent_MakeAvailable(Catch2)
endif()

FetchContent_Declare(
	boost-math
	GIT_REPOSITORY git@git.tu-berlin.de:wahyd/hmspp/boost-math.git
	GIT_TAG        1.79.0
	GIT_SHALLOW    true
	GIT_PROGRESS   true

	SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boost
	CMAKE_ARGS
	-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
	-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
	-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
	-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
	-DSPDLOG_BUILD_SHARED=OFF
)
FetchContent_MakeAvailable(boost-math)

set(FETCHCONTENT_UPDATES_DISCONNECTED false)
FetchContent_Declare(
	swmm
	GIT_REPOSITORY git@github.com:Juli007001/swmm-xy.git
	GIT_TAG v5.2.0-xy
	GIT_PROGRESS TRUE
	SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/swmm
	CMAKE_ARGS
	-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
	-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
	-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
	-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
	-DSPDLOG_BUILD_SHARED=OFF
)
FetchContent_MakeAvailable(swmm)
include_directories(
	${swmm_SOURCE_DIR}
	${swmm_SOURCE_DIR}/src/solver
	${swmm_SOURCE_DIR}/src/solver/include
)


add_subdirectory(fparser)
add_subdirectory(xml)

add_library(eigen-fmt fmt.h)
target_include_directories( eigen-fmt PUBLIC
	# ${FETCHCONTENT_BASE_DIR}/spdlog-src/include
	${spdlog_SOURCE_DIR}/include
)
target_link_libraries( eigen-fmt PUBLIC ${EIGEN} )
set_target_properties(eigen-fmt PROPERTIES
	LINKER_LANGUAGE CXX
)
